package pri.zxx.testdemo;

import org.apache.commons.collections4.map.HashedMap;
import org.junit.jupiter.api.Test;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Objects;

/**
 * @author Twilight
 * @desc
 * @createTime 2020-05-23-19:20
 */
public class CharsetTest {
	public static final Charset UTF_8 = Charset.forName("UTF-8");

	public static void main(String[] args) {
		String name = UTF_8.name();
		System.out.println(name);
		System.out.println("---------------------------------");
		System.out.println(StandardCharsets.UTF_8.toString());
		System.out.println(StandardCharsets.UTF_8.name());
		System.out.println(StandardCharsets.UTF_8.aliases());
		System.out.println(StandardCharsets.UTF_8.displayName());
		System.out.println(StandardCharsets.UTF_8.isRegistered());
		System.out.println("---------------------------------");
		System.out.println(UTF_8);
	}

	@Test
	public void myTest() {
		String url = null;
		Objects.requireNonNull(url, "对象不能为空");
		System.out.println(url);
	}

	@Test
	public void myTest2() {
		Map<String, Object> map = new HashedMap<>();
		map.put("user", "zxx");
		map.put("user2", "zxxas");
	}
}
